/*
 * =====================================================================================
 *
 *       Filename:  main.cc
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  01/11/2022 01:07:39 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  first_name last_name (fl), fl@my-company.com
 *        Company:  my-company
 *
 * =====================================================================================
 */

#include "IHuman.h"
#include "YellowHuman.h"
#include "WhiteHuman.h"
#include "BlackHuman.h"
#include "SimpleHumanFactory.h"
#include <iostream>
using std::cout;
using std::endl;
using std::string;

void DoSimpleFactory() {
    CSimpleHumanFactory* pSimpleHumanFactory = new CSimpleHumanFactory();
    cout << "----------第一批人是这样的：黄种人" << endl;
    IHuman* pYellowHuman = pSimpleHumanFactory->CreateHuman("CYellowHuman");
    pYellowHuman->Cry();
    pYellowHuman->Laugh();
    pYellowHuman->Talk();
    delete pYellowHuman;
    cout << "----------第二批人是这样的：白种人" << endl;
    IHuman* pWhiteHuman = pSimpleHumanFactory->CreateHuman("CWhiteHuman");
    pWhiteHuman->Cry();
    pWhiteHuman->Laugh();
    pWhiteHuman->Talk();
    delete pWhiteHuman;
    cout << "----------第三批人是这样的：黑种人" << endl;
    IHuman* pBlackHuman = pSimpleHumanFactory->CreateHuman("CBlackHuman");
    pBlackHuman->Cry();
    pBlackHuman->Laugh();
    pBlackHuman->Talk();
    delete pBlackHuman;
#if 0
    cout << "----------第四批人是这样的：生产黄种人的工厂，采用了模板的方式。" << endl;
    CStandardHumanFactory < CYellowHuman > standardHumanFactory;
    pYellowHuman = standardHumanFactory.CreateHuman();
    pYellowHuman->Cry();
    pYellowHuman->Laugh();
    pYellowHuman->Talk();
    delete pYellowHuman;
#endif
}

int main() {
    DoSimpleFactory();
    return 0;
}
